<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="pragma" content="no-cache">  <!-- HTTP 1.1 -->
    <meta http-equiv="cache-control" content="no-cache,must-revalidate">  <!-- HTTP 1.0 -->
    <meta name="renderer" content="webkit|ie-comp|ie-stand"/> <!--优先级：极速模式，兼容模式，IE模式-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <title>扬州房产测绘业务管理系统</title>
    <link rel="stylesheet" type="text/css" href="../../../libs/jeasyui-181/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../../libs/jeasyui-181/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../../../libs/jeasyui-181/themes/color.css">
    <link rel="stylesheet" type="text/css" href="../../../css/common.css">
    <style>
        .wall {
            margin-left: 200px;
            display: inline-block;
        }
    </style>
    <script type="text/javascript" src="../../../libs/jeasyui-181/jquery.min.js"></script>
    <script type="text/javascript" src="../../../libs/jeasyui-181/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../../libs/thUtil.js"></script>
</head>
<body>
<div id="toolbar">
    <div class="search">
        <div class="bar-btn" style="float:right">
            <a id="search_Link" href="#" class="easyui-linkbutton insert">查看信息</a>
            <a id="moveData_Link" href="#" class="easyui-linkbutton update">数据迁移</a>
            <a id="moveAdminArea_Link" href="#" class="easyui-linkbutton update">县市迁移</a>
            <a id="save_Link" href="#" class="easyui-linkbutton update">保存</a>
        </div>
    </div>
</div>
<div>
    <form id="baseForm" method="post">
        <input type="hidden" id="id" name="id" value=""/>
        <div>
            <div>
                <table id="baseTable" class="form-wrap" style="margin-left: 30px">
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="adminArea" id="adminArea"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '行政区域:',
                                                        required: true,
                                                        readonly:true,
                                                        disabled:true,
                                                        validType: 'length[2,50]',"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="projectNo" id="projectNo"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '项目编号:',
                                                        required: true,
                                                        readonly:true,
                                                         disabled:true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="projectName" id="projectName"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '项目名称:',
                                                        padding:300,
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="mappingType" id="mappingType"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '测绘类别:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="fromUnit" id="fromUnit"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '建设单位:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="housePosition" id="housePosition"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '房屋坐落:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="devProNo" id="devProNo"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '开发项目:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="contract" id="contract"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '联系 人:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="tel" id="tel"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '联系电话:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="licence" id="licence"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '规划许可证:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="area" id="area"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '规许面积:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="landNo" id="landNo"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '土地证号:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="landArea" id="landArea"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '土地证面积:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="receiveDate" id="receiveDate"
                                   data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '收件日期:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                            <div class="wall">
                                <input type="text" class="easyui-textbox" name="receiverName" id="receiverName"
                                       data-options="   width: 500,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '收件人:',
                                                        required: true,
                                                        readonly:true,
                                                        disabled:true,
                                                        validType: 'length[2,50]',"/>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="rem" id="rem"
                                   data-options="   width: 1210,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '备注:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="easyui-textbox" name="reportRem" id="reportRem"
                                   data-options="   width: 1210,
                                                        labelWidth:200,
                                                        labelPosition: 'left',
                                                        label: '办理情况备注:',
                                                        required: true,
                                                        validType: 'length[2,50]',"/>
                        </td>
                    </tr>
                </table>

            </div>
        </div>
    </form>
</div>
</body>
<script>
    $(function () {
        $('#save_Link').html(button.save).linkbutton({onClick: ajax.save})
        ajax.getBaseInfo();
    });
    var ajax = {
        getBaseInfo: function () {
            var todoId = ajax.getHrefKey("todoId");
            Network.connect(window.api.caseDetail, "POST", {todoId: todoId}, function (res) {
                if (res.code === ResponseCode.OK) {
                    var baseInfo = res.data;
                    $('#id').val(baseInfo.id);
                    var tds = $("#baseTable td");
                    tds.each(function () {
                        var inputs = $(this).find("input");
                        inputs.each(function () {
                            if ($(this).hasClass("easyui-textbox textbox-f")) {
                                var id = $(this).attr("id");
                                if (id === "adminArea") {
                                    var adminAreaArr = baseInfo.enumItems["23"];
                                    $('#adminArea').combobox({
                                        valueField: 'nameCode',
                                        textField: 'name'
                                    }).combobox('loadData', adminAreaArr);

                                } else if (id === "devProNo") {
                                    var devProNoArr = [
                                        {nameCode: "-1", name: "请选择", selected: true},
                                        {nameCode: "1", name: "开发项目1"},
                                        {nameCode: "2", name: "开发项目2"}];

                                    $('#devProNo').combobox({
                                        valueField: 'nameCode',
                                        textField: 'name'
                                    }).combobox('loadData', devProNoArr);

                                } else if (id === "mappingType") {

                                    var mappingTypeArr = baseInfo.enumItems["10"];
                                    $('#mappingType').combobox({
                                        valueField: 'nameCode',
                                        textField: 'name'
                                    }).combobox('loadData', mappingTypeArr);

                                } else {
                                    $("#" + id).textbox("setValue", baseInfo[id]);
                                }
                            }
                        });

                    })
                }
            })
        },
        /**
         * @return {null}
         */
        getHrefKey: function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r !== null) {
                return (r[2]);
            } else {
                return null;
            }
        },
        save: function () {

            $('#baseForm').form('submit', {
                url: window.api.caseSave,
                onSubmit: function () {
                    var isValid = $(this).form('validate');
                    if (isValid) {
                        var formData = $(this).serializeJson();
                        Network.connect(window.api.caseSave, "POST", formData, function (res) {
                            if (res.code === ResponseCode.OK) {
                                Tools.show(res.message);
                            }
                        });
                    }
                    return isValid;
                }
            });

        }
    }
</script>
</html>